import pymysql
mysqldb = pymysql.connect(
    host ='localhost',
    user = 'root',
    password = '123456',
    database = 'test7_7',
    port = 3306,
    charset = 'utf8'
)
mycursor =mysqldb.cursor()#创建表
sql ='create table person (username varchar(20),age int, sex char(4),high double(3,2))'
mysqldb.commit()
mycursor.close()
mysqldb.close()
for i in range(10):
    #val = input()
    val = input('输入四个数据，空格隔开').split()
    #sql = 'insert into person(username) values(%s)'
    sql ='insert into person(username,age,sex,high) values(%s,%s,%s,%s)'
    mycursor.execute(sql,val)
    mysqldb.commit()
mycursor.close()
mysqldb.close()